package graph;

import java.util.Arrays;

public class TGraphTest {
    public static void main(String[] args) {
        TGraph graph = new TGraph(10);
        graph.addEdge(1, 2);
        graph.addEdge(2, 3);
        graph.addEdge(4, 10);
        graph.addEdge(4, 5);
        graph.addEdge(7, 5);
        graph.addEdge(2, 8);
        graph.addEdge(9, 8);
        graph.addEdge(7, 6);
        System.out.println("边数" + graph.E());
        System.out.println("节点数" + graph.V());
        System.out.println("图:\n" + graph.toString());
        System.out.println("节点2的邻接点:" + Arrays.toString(graph.adj(2)));
        System.out.println("节点2的度:" + graph.getDegree(2));
        System.out.println("DFS:");
        graph.DFS(1);
        System.out.println("BFS:");
        graph.BFS(1);

        System.out.println(Arrays.toString(graph.singleSourceShortestPath(1)));
    }
}